package lpl.com.xyd.test.manage.controller;

import lpl.com.xyd.test.manage.common.response.HttpResponse;
import lpl.com.xyd.test.manage.common.utils.ContentType;
import lpl.com.xyd.test.manage.common.utils.excel.ExcelMain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/excel")
public class ExcelCotroller {

    @Autowired
    private ExcelMain excelMain;

    @RequestMapping(value = "/excute",method = RequestMethod.POST,produces = {ContentType.APPLICATION_JSON_UTF_8,
            ContentType.TEXT_XML_UTF_8 })
    public HttpResponse excute(){
        HttpResponse response = new HttpResponse();
        boolean result = excelMain.excute();
        if (!result){
            response.failfure();
            response.setMessage("失败");
            return response;
        }
        response.successful();
        response.setMessage("成功");
        return response;
    }
}
